package com.supersoul.myself.controller;

import com.supersoul.myself.entity.bo.Prize;
import com.supersoul.myself.ex.ServiceException;
import com.supersoul.myself.service.LotteryService;
import com.supersoul.myself.service.impl.LotteryServiceImpl;
import com.supersoul.myself.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/lottery")
public class LotteryController {

    @Autowired
    private LotteryService lotteryService;

    @GetMapping("/goLottery")
    public R goLottery() throws ServiceException {
        Prize prize = lotteryService.goLottery();
        return R.success(prize);
    }

    @GetMapping("/getPrizeList")
    public R getPrizeList() throws ServiceException {
        return R.success(LotteryServiceImpl.prizeList);
    }

}
